<!DOCTYPE html><html><head><title>Ext.TaskManager | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
<style type="text/css">.head-band { display: none; }
.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
.doc-tab .members .member a.more { background-color: #efefef; }
</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">

    req = {
        liveURL: '.',
        standAloneMode: true,
        origDocClass: 'Ext.TaskManager',
        docClass: 'Ext.TaskManager',
        docReq: 'Ext.TaskManager',
        version: '4.0',
        baseURL: '.',
        baseDocURL: '.',
        baseProdURL: '.'
    };

    clsInfo = {};



</script>

<script type="text/javascript" src="../search.js"></script>
<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
<script type="text/javascript" src="../class_tree.js"></script>
<script type="text/javascript" src="../class_doc.js"></script>
<script type="text/javascript">
    req.source = 'TaskManager.html#Ext-TaskManager';
    clsInfo = {"methods":["TaskManager","start","stop","stopAll"],"cfgs":[],"properties":[],"events":[],"subclasses":[]};
    Ext.onReady(function() {
        Ext.create('Docs.classPanel');
    });
</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/TaskManager.html#Ext-TaskManager" target="_blank">Ext.TaskManager</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><pre class="subclasses"><h4>Hierarchy</h4><div class="subclass f"><a href="Ext.util.TaskRunner.html" rel="Ext.util.TaskRunner" class="cls docClass">Ext.util.TaskRunner</a><div class="subclass"><strong>Ext.TaskManager</strong></div></div></pre><p>A static <a href="Ext.util.TaskRunner.html" rel="Ext.util.TaskRunner" class="docClass">Ext.util.TaskRunner</a> instance that can be used to start and stop arbitrary tasks.  See
<a href="Ext.util.TaskRunner.html" rel="Ext.util.TaskRunner" class="docClass">Ext.util.TaskRunner</a> for supported methods and task config properties.</p>

<pre class="prettyprint"><code>// Start a simple clock task that updates a div once per second
var task = {
    run: function(){
        Ext.fly('clock').update(new Date().format('g:i:s A'));
    },
    interval: 1000 //1 second
}
Ext.TaskManager.start(task);
</code></pre>


<p>See the <a href="Ext.TaskManager.html#start" rel="Ext.TaskManager#start" class="docClass">start</a> method for details about how to configure a task object.</p>

<div class="members"><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-TaskManager" class="member f inherited"><a href="Ext.TaskManager.html#method-TaskManager" rel="method-TaskManager" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.TaskRunner.html" class="definedIn docClass">Ext.util.TaskRunner</a><br/><a href="../source/TaskManager.html#Ext-util.TaskRunner-method-constructor" class="viewSource">view source</a></div><a name="TaskManager"></a><a name="method-TaskManager"></a><a href="Ext.TaskManager.html#" rel="method-TaskManager" class="cls expand">TaskManager</a>(
<span class="pre">[Number interval]</span>)
 : void</div><div class="description"><div class="short"><p>&nbsp;</p></div><div class="long">
<h3 class="pa">Parameters</h3><ul><li><span class="pre">interval</span> : Number<div class="sub-desc"><p>(optional) The minimum precision in milliseconds supported by this TaskRunner instance
(defaults to 10)</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-start" class="member inherited"><a href="Ext.TaskManager.html#method-start" rel="method-start" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.TaskRunner.html" class="definedIn docClass">Ext.util.TaskRunner</a><br/><a href="../source/TaskManager.html#Ext-util.TaskRunner-method-start" class="viewSource">view source</a></div><a name="start"></a><a name="method-start"></a><a href="Ext.TaskManager.html#" rel="method-start" class="cls expand">start</a>(
<span class="pre">[Object task]</span>)
 : Object</div><div class="description"><div class="short"><p>Starts a new task.</p>
</div><div class="long"><p>Starts a new task.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">task</span> : Object<div class="sub-desc"><p>A config object that supports the following properties:<ul>
<li><code>run</code> : Function<div class="sub-desc"><p>The function to execute each time the task is invoked. The
function will be called at each interval and passed the <code>args</code> argument if specified, and the
current invocation count if not.</p>
<p>If a particular scope (<code>this</code> reference) is required, be sure to specify it using the <code>scope</code> argument.</p>
<p>Return <code>false</code> from this function to terminate the task.</p></div></li>
<li><code>interval</code> : Number<div class="sub-desc">The frequency in milliseconds with which the task
should be invoked.</div></li>
<li><code>args</code> : Array<div class="sub-desc">(optional) An array of arguments to be passed to the function
specified by <code>run</code>. If not specified, the current invocation count is passed.</div></li>
<li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (<tt>this</tt> reference) in which to execute the
<code>run</code> function. Defaults to the task config object.</div></li>
<li><code>duration</code> : Number<div class="sub-desc">(optional) The length of time in milliseconds to invoke
the task before stopping automatically (defaults to indefinite).</div></li>
<li><code>repeat</code> : Number<div class="sub-desc">(optional) The number of times to invoke the task before
stopping automatically (defaults to indefinite).</div></li>
</ul></p>


<p>Before each invocation, <a href="Ext.html" rel="Ext" class="docClass">Ext</a> injects the property <code>taskRunCount</code> into the task object so
that calculations based on the repeat count can be performed.</p>

</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span>&nbsp; &nbsp;<p>The task</p>
</li></ul></div></div></div><div id="method-stop" class="member inherited"><a href="Ext.TaskManager.html#method-stop" rel="method-stop" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.TaskRunner.html" class="definedIn docClass">Ext.util.TaskRunner</a><br/><a href="../source/TaskManager.html#Ext-util.TaskRunner-method-stop" class="viewSource">view source</a></div><a name="stop"></a><a name="method-stop"></a><a href="Ext.TaskManager.html#" rel="method-stop" class="cls expand">stop</a>(
<span class="pre">Object task</span>)
 : Object</div><div class="description"><div class="short"><p>Stops an existing running task.</p>
</div><div class="long"><p>Stops an existing running task.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">task</span> : Object<div class="sub-desc"><p>The task to stop</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span>&nbsp; &nbsp;<p>The task</p>
</li></ul></div></div></div><div id="method-stopAll" class="member inherited"><a href="Ext.TaskManager.html#method-stopAll" rel="method-stopAll" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.TaskRunner.html" class="definedIn docClass">Ext.util.TaskRunner</a><br/><a href="../source/TaskManager.html#Ext-util.TaskRunner-method-stopAll" class="viewSource">view source</a></div><a name="stopAll"></a><a name="method-stopAll"></a><a href="Ext.TaskManager.html#" rel="method-stopAll" class="cls expand">stopAll</a> : void</div><div class="description"><div class="short"><p>Stops all tasks that are currently running.</p>
</div><div class="long"><p>Stops all tasks that are currently running.</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>